package com.ctgu.rabbitmq.controller;

import com.ctgu.rabbitmq.service.ExchangeService;
import com.ctgu.rabbitmq.utils.ApiResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ ClassName ExchangeController
 * @ Author Alex2
 * @ Date 2025/8/15 8:59
 **/
@RestController
@RequestMapping("/api/exchange")
public class ExchangeController {
    @Autowired
    private ExchangeService exchangeService;

    /**
     * @ Author: Alex
     * @ Description: 默认交换机
     */
    // http://localhost:8080/api/exchange/defaultExchange
    @GetMapping("defaultExchange")
    public ApiResult defaultExchange() {
        return exchangeService.defaultExchange();
    }

    /**
     * @ Author: Alex
     * @ Description: 扇出交换机
     */
    // http://localhost:8080/api/exchange/fanoutExchange
    @GetMapping("fanoutExchange")
    public ApiResult fanoutExchange() {
        return exchangeService.fanoutExchange();
    }

    /**
     * @ Author: Alex
     * @ Description: 直连交换机
     */
    // http://localhost:8080/api/exchange/directExchange
    @GetMapping("directExchange")
    public ApiResult directExchange() {
        return exchangeService.directExchange();
    }

    /**
     * @ Author: Alex
     * @ Description: 主题交换机
     */
    // http://localhost:8080/api/exchange/topicExchange
    @GetMapping("topicExchange")
    public ApiResult topicExchange() {
        return exchangeService.topicExchange();
    }

    /**
     * @ Author: Alex
     * @ Description: 头部交换机
     */
    // http://localhost:8080/api/exchange/headersExchange
    @GetMapping("headersExchange")
    public ApiResult headers() {
        return exchangeService.headersExchange();
    }

    /**
     * @ Author: Alex
     * @ Description: 备用交换机
     */
    // http://localhost:8080/api/exchange/alternateExchange
    @GetMapping("alternateExchange")
    public ApiResult alternateExchange() {
        return exchangeService.alternateExchange();
    }
}